package com.myorg.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ConstantsToBeExternalized {
	final static private Logger logger = LoggerFactory.getLogger(ConstantsToBeExternalized.class);

	public final static String ZOOKEEPER_HOST = "localhost";
	public final static boolean ZOOKEEPER_ENABLED = false;
	public final static int MAX_NUM_OF_FILES_UPLOAD = 10;
	public final static int MAX_SIZE_OF_FILES_UPLOAD = 1 * 1024 * 1024 * 1024;
	public final static String DEFAULT_DIR_FILES_UPLOAD = "/in";
	public final static int BUFFER_SIZE_FOR_DECOMPRESSION = 2048;

	public final static int DEFAULT_NUM_OF_EMAILS_PER_PAGE = 7;

	public final static String DICTIONARY_URL_REMOTE = "https://raw.githubusercontent.com/eneko/data-repository/master/data/words.txt";
	public final static String DICTIONARY_URL_LOCAL = "file:///home/mma/workspace/EmailSearch/data/words";

	public final static int DEFAULT_SOCKET_TIMEOUT = 10 * 60 * 1000;
	public final static int DEFAULT_CONNECTION_TIMEOUT = 10 * 60 * 1000;

	public final static int MAX_LENGTH_OF_EMAIL = 10 * 1024 * 1024;

	public final static boolean EMAIL_DELIMITER_FAST_TRACK = true;

	public static int NUM_OF_SEARCH_THREAD_ON_NODE = 1;

	public static int DEFAULT_HDFS_READ_BUFFER_SIZE = 5 * 1024 * 1024;

	public static long MAX_SERVER_IDLE_TIME_BEFORE_SHUTDOWN = 30 * 60 * 1000L;
	
	public static String SHUTDOWN_NOTIFICATION_URL = "http://emaildemo-bigdatax.rhcloud.com/demo_shutdown.jsp";
	
	static {
		String val = System.getProperty("NUM_OF_SEARCH_THREAD_ON_NODE");
		if (val != null && !"".equals(val)) {
			NUM_OF_SEARCH_THREAD_ON_NODE = Integer.parseInt(val);
		}
		logger.info("NUM_OF_SEARCH_THREAD_ON_NODE=" + NUM_OF_SEARCH_THREAD_ON_NODE);

		val = System.getProperty("DEFAULT_HDFS_READ_BUFFER_SIZE");
		if (val != null && !"".equals(val)) {
			DEFAULT_HDFS_READ_BUFFER_SIZE = Integer.parseInt(val);
		}
		logger.info("DEFAULT_HDFS_READ_BUFFER_SIZE=" + DEFAULT_HDFS_READ_BUFFER_SIZE);
	}
}
